<template>
  <div class="home-container">
    <div class="home-card">
      <div class="title-container">
        <h1 class="title">欢迎来到宿舍管理系统</h1>
      </div>
      <p class="subtitle">一个高效便捷的管理平台</p>
      <router-link to="/login" class="login-btn">
        <el-button type="primary" size="large">前往登录</el-button>
      </router-link>
    </div>
  </div>
</template>

<script>
export default {
  name: 'Home'
};
</script>

<style scoped>
/* 全局重置确保无偏移 */
body, html {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.home-container {
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: url('../assets/img/homeback.jpg') no-repeat center center fixed;
  background-size: cover;
  position: fixed; /* 确保全屏不滚动 */
  top: 0;
  left: 0;
}

.home-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 15px;
  padding: 50px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  width: 90%;
  max-width: 800px;
  text-align: center;
  transition: all 0.3s ease;
  margin: 0 auto; /* 双重保障居中 */
}

.title-container {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.title {
  font-size: 2.5rem;
  color: #333;
  font-weight: 600;
  white-space: nowrap;
  display: inline-block;
  margin: 0; /* 清除默认h1边距 */
}

.subtitle {
  font-size: 1.2rem;
  color: #666;
  margin: 0 auto 40px; /* 上下左右居中 */
  max-width: 80%; /* 防止文字过长 */
}

.login-btn {
  text-decoration: none;
  display: inline-block; /* 确保按钮居中 */
}

.login-btn .el-button {
  width: 200px;
  height: 50px;
  font-size: 1.1rem;
}

/* 响应式调整 */
@media (max-width: 992px) {
  .title {
    font-size: 2.2rem;
  }
}

@media (max-width: 768px) {
  .home-card {
    padding: 30px;
    width: 85%;
    max-width: 600px;
  }
  
  .title {
    white-space: normal; /* 小屏幕允许换行 */
  }
  
  .subtitle {
    font-size: 1rem;
    max-width: 90%;
  }
}

@media (max-width: 480px) {
  .home-card {
    padding: 25px 20px;
  }
  
  .title {
    font-size: 1.8rem;
    line-height: 1.3;
  }
  
  .login-btn .el-button {
    width: 180px;
    height: 45px;
  }
}
</style>